<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var fight_grap = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
      function fight(str) {
        var red = [];
        for (var i = 0; i < 5; i++) {
          var mr = parseInt(Math.random() * str.length);
          red.push(str.splice(mr, 1));
        }
        for (var i = 0; i < 5; i++) {
          document.write("第" + i + "组：" + red[i] + "和" + str[i] + "<br>");
        }
      }
      fight(fight_grap);
    </script>
  </body>
</html>
